//
//  BaseParmModel.h
//  IOS7Test
//
//  Created by zhangtie on 13-11-6.
//  Copyright (c) 2013年 zhangtie. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "QBModelBase.h"

#define QB_SET_RETAINPARM(__property__, __key__)\
{\
    _SETTER_RETAIN(__property__)\
    if(__property__)\
    {\
        [self setParm:__property__ forKey:__key__];\
    }\
}

#define QB_SET_RETAIN_INTPARM(__property__, __key__)\
{\
    _##__property__ = __property__;\
    [self setParm:[NSString stringWithFormat:@"%d", __property__] forKey:__key__];\
}

#define QB_SET_RETAIN_NUMPARM(__property__, __key__)\
{\
_##__property__ = __property__;\
[self setParm:[NSNumber numberWithInt:__property__] forKey:__key__];\
}

#define QB_SET_RETAIN_ARRAYPARM(__property__, __key__)\
{\
    _SETTER_RETAIN(__property__)\
    [self setParm:[QBUtil jsonStringWithArray:__property__] forKey:__key__];\
}

@protocol QBBaseParmModelProtocol <NSObject>

@optional
+ (id)parmObj;      //创建一个自动释放的实例

@end

@interface QBBaseParmModel : QBModelBase<QBBaseParmModelProtocol>

@property(nonatomic, assign)int num;

- (NSDictionary*)parm2jsonObj;  //请求传输时需转成字典给ztrequst

- (void)setParm:(id)parmVal forKey:(NSString*)parmName;

- (id)parmValForKey:(NSString*)key;

@end
